package main;

/**
 * Class that is representing a line on a plane.
 * 
 * @author Michal Stojek
 */
public class Line {

	private double A;
	private double B;
	private double C;
	
	/**
	 * Creates new instance of a class Line.
	 * 
	 * @param a	parameter A of a line specified by equation Ax+By+C=0
	 * @param b	parameter B of a line specified by equation Ax+By+C=0
	 * @param c	parameter C of a line specified by equation Ax+By+C=0
	 */
	public Line(double a, double b, double c) {
		A = a;
		B = b;
		C = c;
	}
	
	/**
	 * Creates new instance of a class Line specified by a point P belonging to this
	 * line and a vector V specifying its direction.
	 * 
	 * @param v	vector V specifying direction of a line
	 * @param p	point P belonging to the line
	 */
	public Line(Vector v, Point p) {
		A = v.getY();
		B = -v.getX();
		C = -A*p.getX()-B*p.getY();
	}
	
	/**
	 * Returns value of A of a line specified by equation Ax+By+C=0.
	 * 
	 * @return value of A
	 */
	public double getA() {
		return A;
	}

	/**
	 * Sets value of A of a line specified by equation Ax+By+C=0.
	 * 
	 * @param a	new value of A
	 */
	public void setA(double a) {
		A = a;
	}

	/**
	 * Returns value of B of a line specified by equation Ax+By+C=0.
	 * 
	 * @return value of B
	 */
	public double getB() {
		return B;
	}

	/**
	 * Sets value of B of a line specified by equation Ax+By+C=0.
	 * 
	 * @param a	new value of B
	 */
	public void setB(double b) {
		B = b;
	}

	/**
	 * Returns value of C of a line specified by equation Ax+By+C=0.
	 * 
	 * @return value of C
	 */
	public double getC() {
		return C;
	}

	/**
	 * Sets value of C of a line specified by equation Ax+By+C=0.
	 * 
	 * @param a	new value of C
	 */
	public void setC(double c) {
		C = c;
	}

	/**
	 * Returns a {@link String} representation of a line in a format "Ax+By+C=0".
	 * 
	 * @return a {@link String} representation of a line in a format "Ax+By+C=0"
	 */
	public String toString() {
		return A+"x+"+B+"y+"+C+"=0";
	}
}
